package net.yxsoft.kit;

import com.jfinal.kit.PropKit;
import net.yxsoft.quorum.MyERC721;
import net.yxsoft.quorum.QuorumKit;
import org.web3j.protocol.core.methods.response.TransactionReceipt;

import java.math.BigInteger;

public class TransferAccountsKit {
    /**
     *  发起转账
     * @param privateKey 私钥
     * @param fromAddress 转出的可信帐号
     * @param toAccount 接收的可信帐号
     * @param tokenId
     * @return
     */
    public static TransactionReceipt TransferAccounts(String toAccount,Long tokenId) throws Exception {
        MyERC721 erc = QuorumKit.getERC721Contract(PropKit.get("quorum.erc721.contractAddress"), PropKit.get("quorum.erc721.privateKey"));

        TransactionReceipt receipt = erc.safeTransferFrom("0x5c5195d270a89c659776ca7805676c6ade046d85","0x79da08f8f5a63c4f1c5213c56cb64321365555f3", BigInteger.valueOf(144185718)).send();

        boolean isOk = false;
        boolean ts=receipt.isStatusOK();
        if(receipt.isStatusOK()){
            //转账成功
        }
        return receipt;
    }
}
